<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Bootstrap -->
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
    <meta charset="utf-8">
  </head>

<script src="http://code.jquery.com/jquery.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript">
var key_="";
$(document).ready(function () {
		//使用方法, url中包含id这个参数
        let key = getUrlParam("key")
        key_='link.'+key;
        $("#key").text(key);

        //从存储中读取配置
		let value = localStorage.getItem('link.'+key);
		if(value){
			$("#config").val(value);
		}

		//绑定确定按钮函数
		$("#save").click(function(){
			let value = $("#config").val();
			localStorage.setItem(key_,value);
		})
    });
//获取url中的参数
function getUrlParam(name) {
   var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
   var r = window.location.search.substr(1).match(reg);  //匹配目标参数
   if (r != null) return decodeURI(r[2]); return null; //返回参数值
 }


$("#save").click(function(){
	let value = $("#config").val();
	localStorage.setItem(key_,value);
})


</script>
<div class="container-fluid">
	<div class="row-fluid">
		<div class="span12">
			<ul class="nav nav-tabs">

				<li>
					<a href="index.html">首页</a>
				</li>
				<li >
					<a href="config.html">全部配置</a>
				</li>
				<li class="dropdown pull-right">
					 <a href="#" data-toggle="dropdown" class="dropdown-toggle">下拉<strong class="caret"></strong></a>
					<ul class="dropdown-menu">
						<li>
							<a href="#">操作</a>
						</li>
						<li>
							<a href="#">设置栏目</a>
						</li>
						<li>
							<a href="#">更多设置</a>
						</li>
						<li class="divider">
						</li>
						<li>
							<a href="#">分割线</a>
						</li>
					</ul>
				</li>
			</ul>
			<h3 id="key" contenteditable="true">h3. 这是一套可视化布局系统.</h3>
			<textarea id="config" rows="3" style="width:30%; ">
			</textarea>
			<div class="row-fluid">
				<div class="span2">

				</div>
				<div class="span1">

				</div>
				<div class="span1">
					<button id="save" class="btn btn-primary" type="button">保存</button>
				</div>

				<div class="span2">
					
				</div>

				<div class="span4">
				</div>
				<div class="span4">
					 
				</div>
			</div>
		</div>
	</div>
</div>